CC = gcc
NASM = nasm
C_TARGET = main
ASM_TARGET = program
C_SOURCE = main.c
ASM_SOURCE = program.asm

all: $(C_TARGET) $(ASM_TARGET)

# C program
$(C_TARGET): $(C_SOURCE)
	$(CC) -o $(C_TARGET) $(C_SOURCE)

# Assembly program
$(ASM_TARGET): $(ASM_SOURCE)
	$(NASM) -f elf32 $(ASM_SOURCE) -o $(ASM_TARGET).o
	ld -m elf_i386 -o $(ASM_TARGET) $(ASM_TARGET).o

clean:
	rm -f $(C_TARGET) $(ASM_TARGET) $(ASM_TARGET).o

.PHONY: all clean